package org.czl.leetCode3;

public class l2412 {
    public long minimumMoney(int[][] transactions) {
        long totalLose = 0;
        int mx = 0;
        for (int[] t : transactions) {
            totalLose += Math.max(t[0] - t[1], 0);
            mx = Math.max(mx, Math.min(t[0], t[1]));
        }
        return totalLose + mx;
    }
}
